package com.census.entity;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;

/**
 * Created by WangKai's Hands.
 * User:WangKai
 * Date:2017/6/30
 * Time:2:35
 * Email: 1786025737@qq.com
 */
@Entity
public class Address {
    private int addressId;
    private String province;
    private String city;
    private String distrity;
    private String detailInfo;

    @Id
    @Column(name = "address_id")
    public int getAddressId() {
        return addressId;
    }

    public void setAddressId(int addressId) {
        this.addressId = addressId;
    }

    @Basic
    @Column(name = "province")
    public String getProvince() {
        return province;
    }

    public void setProvince(String province) {
        this.province = province;
    }

    @Basic
    @Column(name = "city")
    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    @Basic
    @Column(name = "distrity")
    public String getDistrity() {
        return distrity;
    }

    public void setDistrity(String distrity) {
        this.distrity = distrity;
    }

    @Basic
    @Column(name = "detail_info")
    public String getDetailInfo() {
        return detailInfo;
    }

    public void setDetailInfo(String detailInfo) {
        this.detailInfo = detailInfo;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Address address = (Address) o;

        if (addressId != address.addressId) return false;
        if (province != null ? !province.equals(address.province) : address.province != null) return false;
        if (city != null ? !city.equals(address.city) : address.city != null) return false;
        if (distrity != null ? !distrity.equals(address.distrity) : address.distrity != null) return false;
        if (detailInfo != null ? !detailInfo.equals(address.detailInfo) : address.detailInfo != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = addressId;
        result = 31 * result + (province != null ? province.hashCode() : 0);
        result = 31 * result + (city != null ? city.hashCode() : 0);
        result = 31 * result + (distrity != null ? distrity.hashCode() : 0);
        result = 31 * result + (detailInfo != null ? detailInfo.hashCode() : 0);
        return result;
    }
}
